Most modem operating systems implement virtual memory. Virtual memory is a seemingly large amount of memory that allows individual application programs in a multi-tasking system to use respective, dedicated address spaces. Each dedicated address space includes addresses from zero to some large number that depends on the particular characteristics of the operating system and the underlying hardware.
In a virtual memory system, an application program is assigned its own virtual address space, which is not available to other application programs. Through its virtual memory, a process has a logical view of memory that does not correspond to the actual layout of physical memory. Each time a program uses a virtual memory address, the virtual memory system translates it into a physical address using a virtual-to-physical address mapping contained in some type of look-up structure and address mapping database.
Rather than attempting to maintain a translation or mapping for each possible virtual address, virtual memory systems divide virtual and physical memory into blocks. In many systems, these blocks are fixed in size and referred to as sections or pages. Data structures are typically maintained in physical memory to translate from virtual page addresses to physical page addresses. These data structures often take the form of conversion tables, normally referred to as page tables. A page table is indexed by virtual page address or number, and generally has a number of entries corresponding to pages in the virtual address space. Each entry is a mapping of a specific page number or virtual page address to a physical page address.
In most virtual memory systems, physical memory includes some form of secondary storage such as a hard disk. When primary, electronic memory becomes full, physical memory pages are moved to the disk until they are accessed again. This process is referred to as paging. Assuming that the hard disk has a large capacity, paging allows the simulation of seemingly unlimited physical memory.
Although hard disks are common, and are becoming less and less expensive, there is a new generation of computers that implement virtual memory systems without the benefit of secondary storage. Currently, these computers primarily comprise so-called handheld computers or “H/PCs” (handheld PCs). H/PCs typically have a limited amount of non-volatile addressable memory such as battery-backed dynamic RAM (random access memory). Some of this memory is allocated for program execution, while the remaining memory is used to implement a file system. While more capable H/PCs might include actual hard disk storage, this is not the usual situation.
These computers impose new restrictions on the use of virtual memory. In systems that included secondary storage, there was little danger of exhausting physical memory since it could be paged to disk. In an H/PC, however, care must be taken to conserve memory usage. In a multi-tasking system, it is possible to launch a program that competes with other programs and with the operating system for available memory. If any particular program makes high memory demands, it is conceivable that other programs might find themselves without enough memory to continue. Even worse, it is possible that the operating system itself could be unable to obtain needed memory, thereby causing a system crash.
It would be desirable to limit memory usage only when required, rather than prospectively limiting application programs to prescribed memory usage limits. However, it would also be desirable to prevent application programs from threatening system stability. The system and methods described below accomplish these goals.